<?php
include('../includes/definer.php');
include(INC.'php/bootstrap.php');
include(INC.'php/clases/array_column.php');

$visitas = Doctrine_Query::create()
        ->select('p.clicks as total, p.descripcion as publicidad, p.id')
        ->from('Publicidad p')
        ->innerJoin('p.estado e WITH e.id <> '.Estado::BORRADO)
        ->limit(5)
        ->offset(0)
        ->orderBy('p.descripcion')
        ->execute(array(), Doctrine::HYDRATE_ARRAY)
;


$result = array(
    'totales' => array_column($visitas, 'total'),
    'publicidades' => array_column($visitas, 'publicidad')   
);
header("Content-type: application/json");
echo(json_encode($result, JSON_NUMERIC_CHECK));
?>
